﻿package mortal.game.view.rebate
{
    import Framework.Util.*;
    import Message.Game.*;
    import Message.Public.*;
    import mortal.common.error.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.view.rebate.item.*;
    import mortal.mvc.core.*;

    public class RebateProxy extends Proxy
    {

        public function RebateProxy()
        {
            return;
        }// end function

        public function getSaleConfig() : void
        {
            rmi.iActiveShop.getSaleConfig_async(new AMI_IPanicBuy_getSaleConfig(this.onGetCfg, this.onFail));
            return;
        }// end function

        private function onGetCfg(param1:AMI_IPanicBuy_getSaleConfig) : void
        {
            return;
        }// end function

        public function closeSalePanel() : void
        {
            rmi.iActiveShop.closeSalePanel_async(new AMI_IPanicBuy_closeSalePanel(null, this.onFail));
            return;
        }// end function

        public function buySellItem(param1:int, param2:int, param3:RebateItem) : void
        {
            return;
        }// end function

        private function onFail(param1:Exception) : void
        {
            MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            return;
        }// end function

        public function getHitTargetInfo(param1:int) : void
        {
            rmi.iActive.getIfCanTakeHitChart_async(new AMI_IActive_getIfCanTakeHitChart(this.getInfoSucc), param1);
            return;
        }// end function

        private function getInfoSucc(param1:AMI_IActive_getIfCanTakeHitChart, param2:SPublicDictIntInt) : void
        {
            Cache.instance.rebate.dayTargetLevelObj = param2.publicDictIntInt;
            NetDispatcher.dispatchCmd(ServerCommand.RebateDayTargetInfoBack, null);
            return;
        }// end function

        public function getTargetActiveReward(param1:int, param2:int, param3:int, param4:int) : void
        {
            var getHitTargetSucc:Function;
            var t_id:* = param1;
            var type:* = param2;
            var targetType:* = param3;
            var targetLevel:* = param4;
            getHitTargetSucc = function (param1:AMI_IActive_takeTargetActiveAwardByID) : void
            {
                var _loc_2:Object = {};
                _loc_2.type = type;
                _loc_2.targetType = targetType;
                _loc_2.targetLevel = targetLevel;
                Cache.instance.rebate.dayTargetLevelObj[targetLevel] = 2;
                NetDispatcher.dispatchCmd(ServerCommand.RebateDayTargetGetRewardBack, _loc_2);
                return;
            }// end function
            ;
            rmi.iActive.takeTargetActiveAwardByID_async(new AMI_IActive_takeTargetActiveAwardByID(getHitTargetSucc), t_id);
            return;
        }// end function

    }
}
